<?php include("header.php"); ?>
	        
	<div id="body">
            <table>
                <tr>
                    <td  valign="top" id="sidebar">
                        <div id="body">
                            <h3>Kategoriat</h3>
                            <ul>
                                <?php
                                foreach($tags as $tag)
                                {
                                    echo '<li><a href="'. site_url("search/search_tag/".$tag['tag_id']).'">'.$tag['name'].'</a></li>';
                                    
                                }
                                ?>
                            </ul>
                        </div>
                    </td>
                    <td valign="top">
                        <div id="body">
                            <?php
                                echo'<h3>Hakutulokset</h3>';
                                if(count($results)>0)
                                {
                                    if(isset($query_string))
                                    {
                                        if(!empty($query_string))
                                            echo'<p>Hakusanalle "'. $query_string .'"</p>';
                                    }
                                    if(isset($query_tag))
                                        echo'<p>Kategorialle "'. $query_tag['name'] .'"</p>';
                                    echo'<ul>';                                      
                                    foreach($results as $res)
                                    {
                                        echo '<li><a href="'. site_url("media/view/".$res['media_id']).'">'.$res['title'].'</a></li>';
                                    }
                                    echo'</ul>';
                                }
                            ?>
                        </div>
                    </td>
                </tr>
            </table>
	</div>
<?php include("footer.php"); ?>  